#include "Avalon/Codecs/Encoder.hpp"
#include "Avalon/IO/Buffer.hpp"

using namespace Avalon;
using namespace Avalon::Codecs;
using namespace Avalon::IO;

Encoder::~Encoder() {}

void Encoder::Encode(const Buffer& source, void* destination,
    int destinationSize, Out<int> encodedSize) {
  Encode(source.GetData(), source.GetSize(), destination, destinationSize,
    Store(encodedSize));
}

void Encoder::Encode(const Buffer& source, Buffer* destination,
    Out<int> encodedSize) {
  Encode(source.GetData(), source.GetSize(), destination, Store(encodedSize));
}

void Encoder::EncodeInPlace(void* data, int size, Out<int> encodedSize) {
  Encode(data, size, data, size, Store(encodedSize));
}

void Encoder::EncodeInPlace(Buffer* data, Out<int> encodedSize) {
  EncodeInPlace(data->GetMutableData(), data->GetSize(), Store(encodedSize));
}
